package blbetter.netze;

import java.io.File;

import neuralNetworks.Neuron;
import neuralNetworks.tool.NNetSaver;

public class NetLoaderOne extends NetLoader {

	public BlBetterNet<? extends Neuron> blBetterNet;

	@Override
	public void loadAll(String path) {
		File dir = new File(path);
		String[] fileNames = dir.list();
		if (fileNames == null) {
			System.out.println("Directory not found!");
			System.exit(1);
		}
		String blBetterNetStr = "";
		for (int i = 0; i < fileNames.length; i++) {
			if (fileNames[i].contains("blBetterNet"))
				// blBetterNet
				blBetterNetStr = fileNames[i];
		}
		// netz laden
		blBetterNet = (BlBetterNet<? extends Neuron>) NNetSaver.load(path + "/" + blBetterNetStr);

	}

	@Override
	public void saveAll(String path) {
		// netz speichern
		NNetSaver.save(blBetterNet, path + "/blBetterNet" + getStructStr(blBetterNet) + ".nn");
	}

}
